#include <iostream>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
 
using namespace std;
const int N = 100005;
int a[N], b[N], n, tree[N], t;

int lowbit(int x){
	return x&(-x);
}

void add(int p){
	for(int i=p;i<=N;i+=lowbit(i)){
		tree[i]++;
	}
}

int sum(int p){
	int s = 0;
	for(int i=p;i>0;i-=lowbit(i)){
		s += tree[i];
	}
	return s;
}

void show(int x, int l, int r){
	int mid = (l+r)/2;
	if(l == r){
		printf("%d ", t);
	}else if(sum(mid) < x){
		show(x, mid+1, r);
	}else{
		t = mid;
		show(x, l, mid);
	}
}

int main(){
    int t, x;
    scanf("%d", &t);
    while(t--){
    	memset(b, 0, sizeof b);
    	memset(tree, 0, sizeof tree);
		scanf("%d", &n);
		for(int i=0;i<n;i++){
			scanf("%d", &x);
			b[x]++;
			add(x);
			if((i+1)%2 == 1){
				show(i/2+1, 0, N-1);
			}
		}
		printf("\n");
	}
    return 0;
}
